IF exists(SELECT * FROM dbo.sysobjects WHERE name='opdrachtenGerangschikt' AND xtype='V') 
BEGIN
	DROP VIEW opdrachtenGerangschikt
END
GO

create view opdrachtenGerangschikt
as
select top 100 percent
o.*,v.volgnummer 
from opdracht as o  
	left join vakvolgorde as v 
	  on o.vakcode = v.vakcode 
order by o.klas,v.volgnummer